<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Qiniu\Auth;

class QiniuServiceProvider extends ServiceProvider
{
    public function register()
    {
        $this->app->singleton('qiniu', function () {
            $accessKey = env('QINIU_ACCESS_KEY');
            $secretKey = env('QINIU_SECRET_KEY');
            $bucket = env('QINIU_BUCKET'); // 你的七牛云空间名称
            $domain = env('QINIU_DOMAIN'); // 你的七牛云空间对应的域名

            $auth = new Auth($accessKey, $secretKey);

            return [
                'auth' => $auth,
                'bucket' => $bucket,
                'domain' => $domain,
            ];
        });
    }
}
